const path = require('path');
const baseDir = path.resolve(__dirname, '../../data/uploads');

module.exports = {
    // 上传目录配置
    dirs: {
        base: baseDir,
        avatars: path.join(baseDir, 'avatars'),
        files: path.join(baseDir, 'files'),
        chunks: path.join(baseDir, 'chunks')
    },
    // 上传URL配置
    urls: {
        // 基础上传URL
        base: '/uploads',
        // 头像上传URL
        avatars: '/uploads/avatars',
        // 文件上传URL
        files: '/uploads/files',
        // 分块上传URL
        chunks: '/uploads/chunks'
    },
    // 上传大小限制配置
    limits: {
        avatarMaxSize: 5 * 1024 * 1024,
        fileMaxSize: 50 * 1024 * 1024,
        chunkMaxSize: 10 * 1024 * 1024
    },
    // 允许上传的文件类型
    allowed: {
        avatar: ['image/jpeg', 'image/png', 'image/gif', 'image/webp'],
        file: ['image/jpeg', 'image/png', 'image/gif', 'image/webp', 'application/pdf', 'application/msword', 'application/vnd.ms-excel', 'application/zip', 'text/plain'],
        large: ['application/octet-stream']
    },
    // 上传哈希配置
    hash: {
        enabled: true,
        headers: ['x-file-hash', 'x-filehash', 'hash', 'filehash'],
        bodyFields: ['hash', 'fileHash', 'filehash'],
        queryFields: ['hash', 'fileHash']
    }
};